package com.entity;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.List;


/**
 * The persistent class for the LINKMAN database table.
 * 
 */
@Entity
@NamedQuery(name="Linkman.findAll", query="SELECT l FROM Linkman l")
public class Linkman implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="LINKMAN_LINKNO_GENERATOR", sequenceName="LINKSEQ",initialValue=1,allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="LINKMAN_LINKNO_GENERATOR")
	private Long linkno;

	private String ltel;

	private String lname;
	
	private String lphone;

	//bi-directional many-to-many association to Customer
	@ManyToMany(fetch=FetchType.EAGER)
	@JSONField(serialize=false)
	@JoinTable(
		name="CUSLINK"
		, joinColumns={
			@JoinColumn(name="LINKNO")
			}
		, inverseJoinColumns={
			@JoinColumn(name="CUSNO")
			}
		)
	private List<Customer> customers;
	
	//bi-directional many-to-one association to Linkman
	@OneToMany(mappedBy="linkman")
	@JSONField(serialize=false)
	private List<Offerinfo> offerinfos;
	
	//bi-directional many-to-one association to Solicitude
	@OneToMany(mappedBy="linkman")
	@JSONField(serialize=false)
	private List<Solicitude> solicitudes;
	
	//bi-directional many-to-one association to Chanceinfo
	@OneToMany(mappedBy="linkman")
	@JSONField(serialize=false)
	private List<Chanceinfo> chanceinfos;

	public Linkman() {
	}

	public Long getLinkno() {
		return this.linkno;
	}

	public void setLinkno(Long linkno) {
		this.linkno = linkno;
	}

	public String getLtel() {
		return this.ltel;
	}

	public void setLtel(String ltel) {
		this.ltel = ltel;
	}

	public String getLname() {
		return this.lname;
	}

	public void setLname(String lname) {
		this.lname = lname;
	}
	
	public String getLphone() {
		return lphone;
	}

	public void setLphone(String lphone) {
		this.lphone = lphone;
	}

	public List<Customer> getCustomers() {
		return this.customers;
	}

	public void setCustomers(List<Customer> customers) {
		this.customers = customers;
	}

	public List<Offerinfo> getOfferinfos() {
		return offerinfos;
	}

	public void setOfferinfos(List<Offerinfo> offerinfos) {
		this.offerinfos = offerinfos;
	}
	
	public Offerinfo addOfferinfo(Offerinfo offerinfo){
		getOfferinfos().add(offerinfo);
		offerinfo.setLinkman(this);
		
		return offerinfo;
	}
	
	public Offerinfo removeOfferinfo(Offerinfo offerinfo){
		getOfferinfos().remove(offerinfo);
		offerinfo.setLinkman(null);
		
		return offerinfo;
	}

	public List<Solicitude> getSolicitudes() {
		return solicitudes;
	}

	public void setSolicitudes(List<Solicitude> solicitudes) {
		this.solicitudes = solicitudes;
	}
	
	public Solicitude addSolicitude(Solicitude solicitude){
		getSolicitudes().add(solicitude);
		solicitude.setLinkman(this);
		
		return solicitude;
	}
	
	public Solicitude removeSolicitude(Solicitude solicitude){
		getSolicitudes().remove(solicitude);
		solicitude.setLinkman(null);
		
		return solicitude;
	}
	
	public List<Chanceinfo> getChanceinfos() {
		return chanceinfos;
	}

	public void setChanceinfos(List<Chanceinfo> chanceinfos) {
		this.chanceinfos = chanceinfos;
	}

	public Chanceinfo addChanceinfo(Chanceinfo chanceinfo){
		getChanceinfos().add(chanceinfo);
		chanceinfo.setLinkman(this);
		
		return chanceinfo;
	}
	
	public Chanceinfo removeChanceinfo(Chanceinfo chanceinfo){
		getChanceinfos().add(chanceinfo);
		chanceinfo.setLinkman(null);
		
		return chanceinfo;
	}

}